Method and device for encoding/decoding residual block on basis of quantization parameter

ABSTRACT

An encoding/decoding device according to the present invention derives a residual coefficient of a residual block from a bitstream, calculates a quantization parameter for the residual block, performs inverse quantization on the residual coefficient by using the quantization parameter, and performs inverse conversion on the inversely quantized residual coefficient, thereby enabling restoration of a residual sample of the residual block.

TECHNICAL FIELD

The present invention relates to a method and apparatus for encoding/decoding a video signal.

BACKGROUND ART

The demand for high resolution, high quality video is increasing in various applications. As the image data becomes high resolution and high quality, the data amount increases relative to the conventional image data. Therefore, when image data is transmitted using a medium such as a conventional wired/wireless broadband line or is stored using a conventional storage medium, the transmission cost and the storage cost are increased. High-efficiency image compression techniques may be utilized to solve these problems caused by the high resolution and high quality of image data.

DISCLOSURE Technical Problem

An object of the present invention is to improve encoding/decoding efficiency of residual blocks.

An object of the present invention is to improve encoding/decoding efficiency through adaptive block division.

Technical Solution

A video encoding/decoding method and apparatus according to the present invention may derive a residual coefficient of a residual block, calculate a quantization parameter for the residual block from a bitstream, perform dequantization on the residual coefficient using the calculated quantization parameter for the residual block, and perform inverse transform on the dequantized residual coefficient to reconstruct a residual sample of the residual block.

In the video encoding/decoding method and apparatus according to the present invention, the quantization parameter may be derived based on at least one of a quantization parameter prediction value or a quantization parameter difference value.

In the video encoding/decoding method and apparatus according to the present invention, the quantization parameter prediction value may be derived based on quantization parameters of one or more neighboring blocks.

In the video encoding/decoding method and apparatus according to the present invention, the neighboring block may be a block spatially or temporally adjacent to the residual block.

In the video encoding/decoding method and apparatus according to the present invention, the quantization parameter difference value may be determined based on a size of a block in which signaling of the quantization parameter difference value is allowed.

The video encoding/decoding method and apparatus according to the present invention may modify the derived quantization parameter based on a predetermined quantization parameter offset.

In the video encoding/decoding method and apparatus according to the present invention, the residual block may be divided into a variable size/shape based on at least one of a quad tree, a binary tree, or a triple tree.

Advantageous Effects

According to the present invention, encoding/decoding efficiency of a residual block may be improved based on at least one of a predetermined quantization parameter predicted value, a quantization parameter difference value, or a quantization parameter offset.

Also, according to the present invention, encoding/decoding efficiency may be improved through block division of a tree structure.

DESCRIPTION OF DRAWINGS

FIG. 1 is a block diagram illustrating an encoding apparatus according to an embodiment of the present invention.

FIG. 2 is a block diagram illustrating a decoding apparatus according an exemplary embodiment of the present invention.

FIG. 3 illustrates a block division type according to an embodiment to which the present invention is applied.

FIG. 4 illustrates a tree structure-based block division method according to an embodiment in which the present invention is applied.

FIG. 5 illustrates a method of reconstructing a residual sample according to an embodiment of the present invention.

FIG. 6 illustrates a method of deriving a quantization parameter prediction value (QPpred) according to an embodiment of the present invention.

FIG. 7 illustrates a method of deriving a quantization parameter prediction value for a chroma component of a block T according to an embodiment of the present invention.

FIG. 8 illustrates a quantization parameter derivation method based on a signaling unit of a quantization parameter difference value (deltaQP) according to an embodiment of the present invention.

FIG. 9 illustrates an inverse transform process of a residual coefficient according to an embodiment of the present invention.

BEST MODE FOR CARRYING OUT THE INVENTION

A video encoding/decoding method and apparatus according to the present invention may derive a residual coefficient of a residual block, calculate a quantization parameter for the residual block from a bitstream, perform dequantization on the residual coefficient using the calculated quantization parameter for the residual block, and perform inverse transform on the dequantized residual coefficient to reconstruct a residual sample of the residual block.

In the video encoding/decoding method and apparatus according to the present invention, the quantization parameter may be derived based on at least one of a quantization parameter prediction value or a quantization parameter difference value.

In the video encoding/decoding method and apparatus according to the present invention, the quantization parameter prediction value may be derived based on quantization parameters of one or more neighboring blocks.

In the video encoding/decoding method and apparatus according to the present invention, the neighboring block may be a block spatially or temporally adjacent to the residual block.

In the video encoding/decoding method and apparatus according to the present invention, the quantization parameter difference value may be determined based on a size of a block in which signaling of the quantization parameter difference value is allowed.

The video encoding/decoding method and apparatus according to the present invention may modify the derived quantization parameter based on a predetermined quantization parameter offset.

In the video encoding/decoding method and apparatus according to the present invention, the residual block may be divided into a variable size/shape based on at least one of a quad tree, a binary tree, or a triple tree.

MODE FOR CARRYING OUT THE INVENTION

The present invention may be changed and modified variously and be illustrated with reference to different exemplary embodiments, some of which will be described and shown in the drawings. However, these embodiments are not intended for limiting the invention but are construed as including includes all modifications, equivalents and replacements which belong to the spirit and technical scope of the invention. Like reference numerals in the drawings refer to like elements throughout.

Although the terms first, second, etc. may be used to describe various elements, these elements should not be limited by these terms. These terms are used only to distinguish one element from another element. For example, a first element could be termed a second element and a second element could be termed a first element likewise without departing from the teachings of the present invention. The term “and/or” includes any and all combinations of a plurality of associated listed items.

It will be understood that when an element is referred to as being “connected to” or “coupled to” another element, the element can be directly connected or coupled to another element or intervening elements. On the contrary, when an element is referred to as being “directly connected to” or “directly coupled to” another element, there are no intervening elements present.

The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used herein, the singular forms “a,” “an” and “the” are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms “include” and/or “have,” when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.

Hereinafter, exemplary embodiments of the invention will be described in detail with reference to the accompanying drawings. Like reference numerals in the drawings refer to like elements throughout, and redundant descriptions of like elements will be omitted herein.

FIG. 1 is a block diagram illustrating an encoding apparatus according to an embodiment of the present invention.

Referring to FIG. 1, the encoding apparatus 100 includes a picture dividing unit 110, prediction units 120 and 125, a transform unit 130, a quantization unit 135, a reordering unit 160, an entropy encoding unit 165, an inverse quantization unit 140, an inverse transform unit 145, a filter unit 150, and a memory 155.

Each of the elements shown in FIG. 1 is shown independently to represent different characteristic functions in the encoding apparatus, and may mean that each element is composed of separate hardware. But, the elements are independently arranged for convenience of description, wherein at least two elements may be combined into a single element, or a single element may be divided into a plurality of elements to perform functions. It is to be noted that embodiments in which some elements are integrated into one combined element and/or an element is divided into multiple separate elements are included in the scope of the present invention without departing from the essence of the present invention.

Some elements are not essential to the substantial functions in the invention and may be optional constituents for merely improving performance. The invention may be embodied by including only constituents essential to embodiment of the invention, except for constituents used to merely improve performance. The structure including only the essential constituents except for the optical constituents used to merely improve performance belongs to the scope of the invention.

The picture dividing unit 110 may divide an input picture into at least one block. In this case, a block may mean a coding unit (CU), a prediction unit (PU), or a transform unit (TU). The division may be performed based on at least one of a quadtree, a binary tree, or a triple tree. The quadtree is a method of dividing an upper block into sub-blocks whose width and height are half of an upper block. The binary tree is a method of dividing an upper block into sub-blocks whose either width or height is half of an upper block. In a binary tree, a block may have a non-square shape as well as a square shape by dividing an upper block based on the above-described binary tree-based division.

In the embodiments of the invention, a CU may be used to refer to not only a unit of encoding but also a unit of decoding.

The prediction units 120 and 125 may include an inter prediction unit 120 to perform inter prediction and an intra prediction unit 125 to perform intra prediction. The prediction units 120 and 125 may determine which of inter prediction and intra prediction is performed on a PU, and may determine specific information (for example, an intra prediction mode, a motion vector, and a reference picture) of the determined prediction method. Here, a processing unit on which prediction is performed may be different from a processing unit for which a prediction method and specific information thereon are determined. For example, a prediction method and a prediction mode may be determined for each PU, while prediction may be performed for each TU. A residual value (residual block) between a generated predicted block and an original block may be input to the transform unit 130. Further, prediction mode information, motion vector information and the like used for prediction may be encoded along with the residual value by the entropy encoding unit 165 and be transmitted to the decoding apparatus. When a specific encoding mode is used, the original block may be encoded and transmitted to the decoding apparatus without generating a prediction block by the prediction units 120 and 125.

The inter prediction unit 120 may predict a PU based on information on at least one picture among a previous picture of a current picture and a subsequent picture of a current picture. In some cases, the inter prediction unit 120 may predict a PU based on information of a partially encoded region in the current picture. The inter prediction unit 120 may include a reference picture interpolation unit, a motion prediction unit, and a motion compensation unit.

The reference picture interpolation unit may be supplied with reference picture information from the memory 155 and generate pixel information less than or equal to an integer pixel on a reference picture. In the case of luma pixels, a DCT-based 8-tap interpolation filter with a variable filter coefficient may be used to generate pixel information less than or equal to an integer pixel in a unit of a ¼ pixel. In the case of chroma pixels, a DCT-based 4-tap interpolation filter with a variable filter coefficient may be used to generate pixel information less than or equal to an integer pixel in a unit of a ⅛ pixel.

The motion prediction unit may perform motion prediction on the basis of the reference picture interpolated by the reference picture interpolation unit. Various methods, such as a full search-based block matching algorithm (FBMA), a three-step search (TSS) algorithm and a new three-step search (NTS) algorithm, may be used to calculate a motion vector. A motion vector has a motion vector value in the unit of a ½ or ¼ pixel on the basis of an interpolated pixel. The motion prediction unit may predict a current PU using different motion prediction methods. Various methods, such as skip mode, merge mode, and advanced motion vector prediction (AMVP) mode, etc. may be used as the motion prediction method.

The intra prediction unit 125 may generate a PU on the basis of information on a reference pixel neighboring to a current block. When a reference pixel is a pixel for which inter prediction has been performed because a block neighboring to the current PU is a block for which inter prediction has been performed, information on a reference pixel in the block for which inter prediction has been performed may be replaced with information on a reference pixel in a block for which intra prediction has been performed. That is, when a reference pixel is not available, information on the unavailable reference pixel may be replaced with information on at least one reference pixel of the available reference pixels.

A prediction mode of intra prediction includes a directional prediction mode in which reference pixel information is used according to a prediction direction and a non-directional prediction mode in which information on direction is not used in performing prediction. A mode for predicting a luma component and a mode for predicting a chroma component may be different from each other. Further, a chroma component may be predicted by using either intra prediction mode used to obtain a luma component or a predicted/reconstructed luma component.

In the intra prediction method, a predicted block may be generated by applying an adaptive intra smoothing (AIS) filter to the reference pixels according to the intra prediction mode. Different types of AIS filters may be applied to the reference pixels. In the intra prediction method, the intra prediction mode of a current PU may be predicted from an intra prediction mode of a PU neighboring to the current PU. In predicting the prediction mode of the current PU using mode information predicted from a neighboring PU, when the current PU and the neighboring PU have the same intra prediction mode, information indicating that the current PU and the neighboring PU have the same intra prediction mode may be transmitted using predetermined flag information. When the current PU and the neighboring PU have different intra prediction modes, information on the intra prediction mode of the current block may be encoded by entropy encoding.

A residual block including residual information may be generated. The residual information is a difference between an original block and a predicted block generated by the prediction units 120 and 125. The generated residual block may be input to the transform unit 130.

The transform unit 130 may transform the residual block including the residual data by using a transform type such as DCT, DST, or the like. In this case, the transform type may be determined based on the intra prediction mode of the prediction unit used to generate the residual block.

The quantization unit 135 may quantize values transformed into a frequency domain by the transform unit 130. A quantization coefficient may be changed depending on a block or importance of an image. Values output from the quantization unit 135 may be provided to the inverse quantization unit 140 and the rearrangement unit 160.

The rearrangement unit 160 may perform the rearrangement of the coefficient values on the quantized residual block.

The rearrangement unit 160 may change coefficients of a two-dimensional (2D) block into coefficients of a one-dimensional (1D) vector through coefficient scanning method. For example, the rearrangement unit 160 may scan a DC coefficient to a coefficient in the high-frequency region using a predetermined scan type, and change it into a one-dimensional vector form.

The entropy encoding unit 165 may perform entropy encoding on the basis of the values obtained by the rearrangement unit 160. Various encoding methods, such as exponential Golomb coding, context-adaptive variable length coding (CAVLC), or context-adaptive binary arithmetic coding (CABAC), may be used for entropy encoding.

The entropy encoding unit 165 may encode a variety of information, such as residual coefficient information and block type information on a CU, prediction mode information, partitioning unit information, PU information, transfer unit information, motion vector information, reference frame information, block interpolation information and filtering information from the rearrangement unit 160 and the prediction units 120 and 125.

The entropy encoding unit 165 may entropy-encode coefficients of a CU input from the rearrangement unit 160.

The inverse quantization unit 140 and the inverse transform unit 145 dequantize the values which are quantized by the quantization unit 135 and inverse-transform the values which are transformed by the transform unit 130. A reconstructed block may be generated by adding the residual values to the predicted PU. The residual values may be generated by the inverse quantization unit 140 and the inverse transform unit 145. The predicted PU may be predicted by the motion vector prediction unit, the motion compensation unit, and the intra prediction unit of the prediction units 120 and 125.

The filter unit 150 may include at least one of a deblocking filter, an offset unit, and an adaptive loop filter (ALF).

The deblocking filter may remove block distortion generated by boundaries between blocks in a reconstructed picture. Whether to apply the deblocking filter to a current block may be determined on the basis of pixels included in several rows or columns of the block. When the deblocking filter is applied to a block, a strong filter or a weak filter may be applied depending on a required deblocking filtering strength. When horizontal filtering and vertical filtering are performed in applying the deblocking filter, the horizontal filtering and vertical filtering may be performed in parallel.

The offset unit may apply the offset with respect to the original image to the deblocking filtered image, in units of pixels. A region to which the offset may be applied may be determined after partitioning pixels of a picture into a predetermined number of regions. The offset may be applied to the determined region in consideration of edge information on each pixel or the method of applying the offset to the determined region.

The ALF may perform filtering based on a comparison result of the filtered reconstructed image and the original image. Pixels included in an image may be partitioned into predetermined groups, a filter to be applied to each group may be determined, and differential filtering may be performed for each group. Information on whether to apply the ALF may be transferred by each coding unit (CU) and a shape and filter coefficients of an ALF to be applied to each block may vary. Further, an ALF with the same form (fixed form) may be applied to a block regardless of characteristics of the block.

The memory 155 may store a reconstructed block or picture output from the filter unit 150, and the stored reconstructed block or picture may be supplied to the prediction units 120 and 125 when performing inter prediction.

FIG. 2 is a block diagram illustrating a decoding apparatus according an exemplary embodiment of the present invention.

Referring to FIG. 2, the decoding apparatus 200 may include an entropy decoding unit 210, a rearrangement unit 215, a dequantization unit 220, an inverse transform unit 225, prediction units 230 and 235, a filter unit 240, and a memory 245.

Each of the elements shown in FIG. 2 is shown independently to represent different characteristic functions in the decoding apparatus, and may mean that each element is composed of separate hardware. But, the elements are independently arranged for convenience of description, wherein at least two elements may be combined into a single element, or a single element may be divided into a plurality of elements to perform functions. It is to be noted that embodiments in which some elements are integrated into one combined element and/or an element is divided into multiple separate elements are included in the scope of the present invention without departing from the essence of the present invention.

The entropy decoding unit 210 may perform entropy decoding on the input bitstream. For example, various methods, such as exponential Golomb coding, CAVLC or CABAC, may be used for entropy encoding.

The entropy decoding unit 210 may decode information associated with intra prediction and inter prediction performed by the encoding apparatus.

The rearrangement unit 215 may perform rearrangement on the bitstream entropy-decoded by the entropy decoding unit 210. The rearrangement unit 215 may reconstruct and rearrange coefficients of a 1D vector into coefficients of a 2D block. The rearrangement unit 215 may be provided with information on coefficient scanning performed by the encoding apparatus and may perform rearrangement using a method of inversely scanning the coefficients, on the basis of scanning order performed by the encoding apparatus.

The dequantization unit 220 may perform dequantization on the basis of a quantization parameter and the rearranged coefficients of the block.

The inverse transform unit 225 may perform inverse-transform of the dequantized transform coefficients based on a predetermined transform type. In this case, the transform type may be determined based on at least one of a prediction mode (inter/intra prediction), a size/shape of a block, an intra prediction mode, a component type (luma/chroma component), or a partition type (QT, BT, TT, etc.)

The prediction units 230 and 235 may generate a prediction block on the basis of information for generating prediction block and information on a previously-decoded block or picture provided. The information for generating prediction block may be provided from the entropy decoding unit 210. The information on a previously-decoded block or picture may be provided from the memory 245.

The prediction units 230 and 235 may include a PU determination unit, an inter prediction unit and an intra prediction unit. The PU determination unit may receive a variety of information, such as PU information, intra prediction mode-related information of the intra prediction method and motion prediction-related information of an inter prediction method, etc. from the entropy decoding unit 210, may determine a PU for a current CU. The PU determination unit may determine which of the inter prediction and the intra prediction is performed on the PU. An inter prediction unit 230 may perform inter prediction on a current PU on the basis of information on at least one picture among a previous picture and a subsequent picture of a current picture including the current PU. An inter prediction unit 230 may use information necessary for inter prediction for the current PU provided from the encoding apparatus. The inter prediction may be performed on the basis of the information of the pre-reconstructed partial region in the current picture including the current PU. To this end, the pre-reconstructed partial region may be added to the reference picture list.

In order to perform inter prediction, it may be determined, in an unit of a CU, whether a motion prediction method for a PU included in the CU is a skip mode, a merge mode, an AMVP mode or a current picture reference mode.

An intra prediction unit 235 may generate a prediction block on the basis of pixel information in a current picture. When a PU is a PU for which intra prediction is performed, intra prediction may be performed based on intra prediction mode information on the PU provided from the encoding apparatus. The intra prediction unit 235 may include an AIS (Adaptive Intra Smoothing) filter, a reference pixel interpolation unit, and a DC filter. The AIS filter performs filtering on reference pixels of a current block. The MS filter may decide whether to apply the filter or not, depending on a prediction mode for the current PU. AIS filtering may be performed on the reference pixels of the current block using the prediction mode for the PU and information on the AIS filter provided from the encoding apparatus. When the prediction mode for the current block is a mode not performing AIS filtering, the AIS filter may not be applied.

When the prediction mode for the PU indicates a prediction mode of performing intra prediction on the basis of pixel values obtained by interpolating the reference pixels, the reference pixel interpolation unit may generate reference pixels in a unit of a fractional pixel less than an integer pixel (i.e. full pixel) by interpolating the reference pixels. When the prediction mode for the current PU indicates a prediction mode of generating a prediction block without interpolating the reference pixels, the reference pixels may not be interpolated. The DC filter may generate a prediction block through filtering when the prediction mode for the current block is the DC mode.

The reconstructed block or picture may be provided to the filter unit 240. The filter unit 240 includes a deblocking filter, an offset unit, and an ALF.

The encoding apparatus may provide information on whether the deblocking filter is applied to a corresponding block or picture, and information on which of a strong filter and a weak filter is applied when the deblocking filter is used. The deblocking filter of the decoding apparatus may be provided with information on the deblocking filter from the encoding apparatus and may perform deblocking filtering on a corresponding block.

The offset unit may apply offset to the reconstructed picture on the basis of information on an offset type and offset value applied to the picture in the encoding process.

The ALF may be applied to a CU on the basis of information on whether the ALF is applied and ALF coefficient information, etc. provided from the encoding apparatus. The ALF information may be included and provided in a specific parameter set.

The memory 245 may store the reconstructed picture or block for use as a reference picture or a reference block and may provide the reconstructed picture to an output unit.

FIG. 3 illustrates a block division type according to an embodiment to which the present invention is applied.

One block (hereinafter, referred to as a first block) may be divided into a plurality of sub-blocks (hereinafter, referred to as a second block) by at least one of a vertical line or a horizontal line. The number of each of the vertical and horizontal lines may be one, two, or more. Here, the first block may be a coding block (CU) which is a basic unit of image encoding/decoding, a prediction block (PU) which is a basic unit of prediction encoding/decoding or a transform block (TU) which is a basic unit of transform encoding/decoding. The first block may be a square block or a non-square block.

The division of the first block may be performed based on a quad tree, a binary tree, a triple tree, etc., and will be described in detail with reference to FIG. 3.

FIG. 3(a) illustrates a quad tree division (QT). QT is a division type in which the first block is divided into four second blocks. For example, when the first block of 2N×2N is divided by QT, the first block may be divided into four second blocks having N×N size. QT may be limited to apply to a square block only, but it is also applicable to a non-square block.

FIG. 3(b) illustrates a horizontal binary tree (hereinafter, referred to as Horizontal BT) division. Horizontal BT is a division type in which the first block is divided into two second blocks by one horizontal line. This division may be performed symmetrically or asymmetrically. For example, when the first block of 2N×2N is divided based on Horizontal BT, the first block may be divided into two second blocks with a height ratio of (a:b). Here, a and b may be the same value, and a may be larger or smaller than b.

FIG. 3(c) illustrates a vertical binary tree (hereinafter, referred to as Vertical BT) division. Vertical BT is a division type in which the first block is divided into two second blocks by one vertical line. This division may be performed symmetrically or asymmetrically. For example, when the first block of 2N×2N is divided based on Vertical BT, the first block may be divided into two second blocks with a width ratio of (a:b). Here, a and b may be the same value, and a may be larger or smaller than b.

FIG. 3(d) illustrates a horizontal triple tree (hereinafter, referred to as Horizontal TT) division. Horizontal TT is a division type in which the first block is divided into three second blocks by two horizontal lines. For example, when the first block of 2N×2N is divided based on Horizontal TT, the first block may be divided into three second blocks with a height ratio of (a:b:c). Here, a, b, and c may be the same value. Alternatively, a and c may be the same, and b may be greater or less than a.

FIG. 3(e) illustrates a vertical triple tree (hereinafter, referred to as Vertical TT) division. Vertical TT is a division type in which the first block is divided into three second blocks by two vertical lines. For example, when the first block of 2N×2N is divided based on Vertical TT, the first block may be divided into three second blocks with a width ratio of (a:b:c). Here, a, b, and c may be the same value or different values. Alternatively, a and c may be the same while b may be greater or less than a. Alternatively, a and b may be the same while c may be greater or less than a. Alternatively, b and c are the same while a may be larger or smaller than b.

The division described above may be performed based on the division information signaled from the encoding apparatus. The division information may include at least one of division type information, division direction information, or division ratio information.

The division type information may specify any one of the division types that are pre-defined in the encoding/decoding apparatus. The pre-defined division type may include at least one of QT, Horizontal BT, Vertical BT, Horizontal TT, Vertical TT, or non-division mode (No split). Alternatively, the division type information may mean information on whether or not QT, BT, or TT is applied, and may be encoded in the form of a flag or an index. In the case of BT or TT, the division direction information may indicate whether it is divided horizontally or vertically. In the case of BT or TT, the division ratio information may indicate the ratio of the width and/or the height of the second block.

FIG. 4 illustrates a tree structure-based block division method according to an embodiment in which the present invention is applied.

The block 400 illustrated in FIG. 4 is assumed to be a square block (hereinafter, referred to as a first block) having a size of 8N×8N and a division depth k. When the division information of the first block indicates QT division, the first block may be divided into four sub-blocks (hereinafter, referred to as a second block). The second block may have a size of 4N×4N and may have a division depth (k+1).

The four second blocks may be divided again based on either QT, BT, TT, or non-division mode. For example, when the division information of the second block indicates a horizontal binary tree (Horizontal BT), the second block is divided into two sub-blocks (hereinafter, referred to as a third block) as the second block 410 of FIG. 4. In this case, the third block may have a size of 4N×2N and may have a division depth (k+2).

The third block may also be divided again based on either QT, BT, TT, or non-division mode. For example, when the division information of the third block indicates a vertical binary tree (Vertical BT), the third block is divided into two sub-blocks 411 and 412 as illustrated in FIG. 4. In this case, the sub-blocks 411 and 412 may have a size of 2N×2N and a division depth (k+3). Alternatively, when the division information of the third block indicates a horizontal binary tree (Horizontal BT), the third block may be divided into two sub-blocks 413 and 414 as illustrated in FIG. 4. In this case, the sub-blocks 413 and 414 may have a size of 4N×N and a division depth (k+3).

The division may be performed independently or in parallel with the neighboring block, or may be performed sequentially according to a predetermined priority order.

The division information of the current block may be determined depending on at least one of the division information of the upper block of the current block or the division information of the neighboring block. For example, when the second block is divided based on Horizontal BT and the upper third block is divided based on Vertical BT, the lower third block does not need to be divided based on Vertical BT. If the lower third block is divided by Vertical BT, this is the same result as the second block is divided by QT. Therefore, encoding for the division information (particularly, the division direction information) of the lower third block may be skipped, and the decoding apparatus may be set so that the lower third block is divided in the horizontal direction.

The upper block may mean a block having a smaller division depth than the division depth of the current block. For example, when the division depth of the current block is (k+2), the division depth of the upper block may be (k+1). The neighboring block may be a block adjacent to the top or left side of the current block. The neighboring block may be a block having the same division depth as the current block.

The above-described division may be repeatedly performed up to the minimum unit of encoding/decoding. When divided into the minimum unit, the division information for the block is no longer signaled from the encoding apparatus. The information on the minimum unit may include at least one of a size or a shape of the minimum unit. The size of the minimum unit may be expressed by the width, the height, the minimum or maximum value of the width and height, the sum of the width and height, the number of pixels, or the division depth. The information on the minimum unit may be signaled in at least one of a video sequence, a picture, a slice, or a block unit. Alternatively, the information on the minimum unit may be a value pre-defined in the encoding/decoding apparatus. The information on the minimum unit may be signaled for each of CU, PU, and TU. Information on one minimum unit may be applied to CU, PU, and TU equally.

FIG. 5 illustrates a method of reconstructing a residual sample according to an embodiment of the present invention.

Referring to FIG. 5, the residual coefficient of the residual block may be derived from a bitstream (S500).

The derivation may be performed by decoding at least one of information on the presence or absence of a non-zero residual coefficient, an absolute value (abs) or a sign of an encoded residual coefficient.

The derivation may further include a process of setting a residual coefficient of a high frequency region in the residual block to 0. The high frequency region may be defined as a region excluding at least one of n columns from a left of the residual block or m rows from a top of the residual block. The n and m may be values pre-committed in the encoding/decoding apparatus, or may be variably determined according to the size/type of the residual block. For example, when the residual block is 64×32, an area excluding 32 columns (here, n=32, m=0) from the left side of the residual block may be defined as a high frequency area. When the residual block is 32×64, an area excluding 32 rows (here, n=0, m=32) from the top of the residual block may be defined as a high frequency region. Alternatively, n and m may be derived based on information encoded to specify a high frequency region.

In addition, the process of setting the residual coefficient to 0 may be selectively performed in consideration of at least one of the size or shape of the residual block. For example, the above process may be applied only when the size of the residual block is greater than or equal to a predetermined threshold. The size of the residual block may be expressed as at least one of a width or a height of the residual block. The threshold value may mean a minimum size allowed to set the residual coefficient to 0. The threshold value may be a value pre-committed in an encoding/decoding of the residual block, or may be encoded and signaled by an encoding of the residual block. The threshold value may be 32, 64, 128, 256 or more.

The process of setting the residual coefficient to 0 may be selectively performed based on flag information. The flag information may indicate whether the residual coefficient of the high frequency area in the residual block is set to 0. The flag information may be derived from a decoding apparatus based on the size/type of the residual block, or may be encoded and signaled by an encoding apparatus. However, the above process may be limited to be performed only when the residual block is not encoded in the transform skip mode. Accordingly, when the residual block is encoded in the transform skip mode, the encoding apparatus may not encode information necessary to set the residual coefficient to 0.

Referring to FIG. 5, a quantization parameter for the residual block may be calculated (S510).

The quantization parameter may be derived using at least one of a quantization parameter prediction value (QPpred) or a quantization parameter difference value (deltaQP). In other words, the quantization parameter may be set to be the quantization parameter prediction value (QPpred) or may be derived by adding the quantization parameter difference value (deltaQP) to the quantization parameter prediction value (QPpred).

For example, when the dequantization is unnecessary for the block (e.g., merge mode, skip mode, no-transform mode, PCM mode, a case that there are no non-zero coefficients in the block (i.e., coded block flag=0), and the like), the quantization parameter difference value (deltaQP) may not be encoded. In this case, the quantization parameter prediction value (QPpred) may be set equal to a quantization parameter.

A method of deriving the quantization parameter prediction value (QPpred) will be described with reference to FIGS. 6 and 7. Meanwhile, the quantization parameter difference value (deltaQP) may be signaled in a predetermined unit, and a quantization parameter deriving method based on a signaling unit of the quantization parameter difference value (deltaQP) will be described with reference to FIG. 8.

The calculation of the quantization parameter may further include a process of modifying the derived quantization parameter based on the predetermined quantization parameter offset (QPoffset).

The quantization parameter offset (QPoffset) may be a fixed value which is pre-defined to the encoding/decoding apparatus, or may be encoded and signaled by the encoding apparatus. The quantization parameter offset (QPoffset) may be signaled in at least one level of a video sequence, picture, slice, tile or block unit. The unit in which the quantization parameter offset is signaled may be larger than the unit in which the quantization parameter difference value is signaled. The value and the number of the quantization parameter offset (QPoffset) may be adaptively determined according to a block size/shape, number of divisions, a prediction mode, an intra prediction mode, a component type (e.g., luma, chroma), and the like.

The number of quantization parameter offsets may be one, two, three, or more. For example, the quantization parameter offset may be defined in at least one of a picture level, a slice level, or a block level. The quantization parameter offset may be defined for each of the intra mode and the inter mode, or may be defined for each of the luma component and the chroma component. Alternatively, a separate offset for the LM mode of the intra prediction mode may be defined. Here, the LM mode may mean a mode in which a chroma block is predicted using prediction/reconstruction samples of a luma block.

Referring to FIG. 5, the dequantization may be performed on the residual coefficient using the calculated quantization parameter (S520).

Specifically, the dequantization may be performed based on at least one of the quantization parameter or a predetermined level scale value. The level scale value may be a value pre-defined to the encoding/decoding apparatus, or may be encoded and signaled by the encoding apparatus. The level scale value may be composed of k integer values of a one-dimensional array. For example, the level scale value may be defined as {40, 45, 51, 57, 64, 72}. However, this does not limit the number of level scale values and integer values. That is, the level scale value may be defined as another value, and the number of level scale values may be defined as 4, 5, 7, 8, or more.

Meanwhile, a predetermined quantization weight m may be further applied to the result of the dequantization, and this process is referred to as scaling.

The quantization weight may be derived as a fixed value pre-committed to the encoding/decoding apparatus (method A). In this case, the quantization weight may be one and the same value regardless of a position of the residual coefficient in the residual block. Alternatively, the quantization weight may be derived based on table information pre-defined in the encoding/decoding apparatus (method B). The table information may define a quantization weight according to at least one of a position of the residual coefficient, a block size, a component type, and a prediction mode. Alternatively, the encoding apparatus may determine the quantization weight for each position of the residual coefficient and encode the quantization weight. The decoding apparatus may derive the quantization weight by decoding information about the encoded quantization weight (method C). In this case, the encoding apparatus may encode only a difference between a quantization weight of a previous position and a quantization weight of a current position. The decoding apparatus may derive the quantization weight of the current position by using the quantization weight of the previously decoded position and the encoded information.

The quantization weight of the residual block may be derived by selecting any one of methods A to C described above. The selection may be performed based on at least one of a size/shape of the residual block, a partition type of the residual block, a prediction mode of the residual block, a component type of the residual block, a transform type of the residual block, or predetermined flag information. The flag information may include a flag regarding whether to apply the quantization weight, a flag regarding whether to skip transform, or etc.

In the above-described methods A to C, the quantization weight of the scaling list may be determined for each of a luma block and a chroma block. For example, a scaling list for each of a luma block and a chroma block may be signaled. Alternatively, the scaling list of the chroma block may be determined by referring to the scaling list of the luma block.

Referring to FIG. 5, a residual sample may be reconstructed by performing an inverse transform on the dequantized residual coefficient (S530).

The inverse transform may be performed based on a predetermined transform type, and the transform type of the residual block may be determined based on the transform candidate set. The transform candidate set may include n transform types. For example, the transform candidate set may comprise at least one of DCT-II, DCT-V, DCT-VIII, DST-I or DST-VII.

In the encoding/decoding apparatus, m transform candidate sets may be defined. Here, m may be 1, 2, 3 or more. The number and/or sort of transform types belonging to one of the m transform candidate sets (hereinafter referred to as a first transform candidate set) may be different from the other one (hereinafter referred to as a second transform candidate set). For example, the first transform candidate set may be composed of p transform types, and the second transform candidate set may be composed of q transform types smaller than p. Alternatively, even when the first and second conversion candidate sets are composed of the same number of transform types, at least one transform type belonging to the first conversion candidate set may be different from the transform type belonging to the second conversion candidate set.

Any one of the m transform candidate sets may be selectively used.

The selection of the transform candidate set may be performed based on the size of the residual block. For example, if the size of the residual block is less than or equal to the threshold value, the first transform candidate set composed of p transform types is selected, and if not, the second transform candidate set composed of q transform types may be selected. The threshold value may be 32, 64, 128, 256 or more, and p may be a value greater than q.

Alternatively, the selection of the transform candidate set may be performed based on information to be signaled from the encoding apparatus. The information may specify any one of m transform candidate sets. The information may be signaled in at least one level of a picture, slice or block.

When the selected transform candidate set includes a plurality of transform types, the encoding apparatus may encode information specifying any one of the plurality of transform types. The decoding apparatus may determine the transform type of the residual block by decoding the encoded information.

Meanwhile, the inverse transform may be selectively performed based on a predetermined flag. Here, the flag may indicate whether the inverse transform is skipped for the residual block. For example, if the flag is 1, an inverse transform is not performed on the residual block, and if the flag is 0, the inverse transform may be performed on the residual block. Therefore, the transform type of the residual block may be derived only when the flag is 0. Alternatively, the inverse transform may be selectively performed based on the properties of the residual block. Based on the properties of the residual block, the decoding apparatus may determine whether or not the inverse transform is skipped. The properties may refer to the size/type of the residual block, the division type, the prediction mode, the component type, or other residual coefficient related encoding parameters.

Additional inverse transform (hereinafter referred to as a second inverse transform) in addition to the inverse transform (hereinafter referred to as a first inverse transform) may be performed, and this will be described with reference to FIG. 9.

FIG. 6 illustrates a method of deriving a quantization parameter prediction value (QPpred) according to an embodiment of the present invention.

Referring to FIG. 6, a quantization parameter prediction value (QPpred) for a block T may be derived based on a quantization parameter of a neighboring block. The block T is a block of an N×M size, and may be square or non-square.

The neighboring block may be a block spatially/temporally adjacent to the block T, and may be a block previously decoded before the block T. For example, the neighboring block may include at least one of a left block, a top block, a left-top block, a right-top block, or a left-bottom block of the block T. Alternatively, the neighboring block may further include a collocated block which temporally corresponds to the block T. The collocated block may be defined as a block belonging to a picture different from the block T and including a position of at least one of a left-top corner sample, a bottom-right corner sample, or a center sample of the block T.

The position of the neighboring block may be a pre-defined position in the encoding/decoding apparatus. For example, the pre-defined position may be a left block and a top block, or may be a left block, a top block, and a top-left block. However, the present invention is not limited to this, and may further include a bottom-left block, a right-top block, and the like. The position of the neighboring block may be variably determined based on at least one property (e.g., size, shape, division depth, division type, component type, etc.) of at least one of the block T or the neighboring block. For example, the neighboring block may be determined to be the block having the largest area among the blocks adjacent to the block T, or may be determined to be the block which the length of the boundary adjacent to each other is the longest. This may be performed for the top block and the left block of the block T, respectively.

Alternatively, the information specifying the position of the neighboring block may be encoded and signaled by the encoding apparatus. The information may be encoded in the form of a flag, an index, or the like. For example, if the information is index 0, the quantization parameter prediction value (QPpred) of block T may be derived using the quantization parameter of the left block. If the information is index 1, the quantization parameter prediction value (QPpred) of the block T may be derived using the quantization parameter of the top block.

The number of the neighboring blocks is n, where n may be a natural number of 1, 2, 3, 4, or more. The number may be a fixed value pre-defined in the encoding/decoding apparatus. Alternatively, the number may be variably determined based on properties (e.g., size, type, division depth, division type, component type, etc.) of at least one of the block T or the neighboring block. Alternatively, the maximum number information for the neighboring blocks used to derive the quantization parameter prediction value (QPpred) of the block T may be encoded and signaled by the encoding apparatus. That is, the block T may use neighboring blocks within the number range according to the maximum number information. The maximum number information may be signaled at a level of at least one of a video sequence, a picture, and other fragment area (e.g., slice, tile, Coding Tree Block row, block).

As described above, the quantization parameter prediction value (QPpred) of block T may be derived using one or more neighboring blocks.

When a plurality of neighboring blocks are used, the quantization parameter prediction value (QPpred) of the block T may be derived through an operation process such as an intermediate value, an average value, a minimum value, a maximum value, or a mode value of quantization parameters of a plurality of neighboring blocks.

Alternatively, the quantization parameter predicted value (QPpred) of the block T may be derived by subtracting the QP of the top-left block from the sum of the QP of the top block and the QP of the left block. In this case, if there are a plurality of top block or left block, the QP of the top block or the left block may be determined through an operation process such as an intermediate value, an average value, a minimum value, a maximum value, or a mode value.

If there is an unavailable block among the neighboring blocks, the quantization parameter prediction value of the block T may be derived using only available neighboring blocks. Alternatively, when the neighboring block is unavailable, the quantization parameter of the neighboring block may be derived based on a quantization parameter defined in a predetermined fragment area. The fragment area may be a slice, a tile, a Coding Tree Block row, a block, or the like. The fragment area may denote an encoded/decoded area before the block T or an area to which the block T to be encoded/decoded belongs. The unavailability may be a case where the neighboring block does not exist physically, or a case where reference is not possible according to the rules of the encoding/decoding apparatus. For example, if block T and a neighboring block belong to different parallel processing areas (e.g., slices, tiles, etc.), block T may not be allowed to refer to the neighboring block.

FIG. 7 illustrates a method of deriving a quantization parameter prediction value for a chroma component of a block T according to an embodiment of the present invention.

Hereinafter, the luma component and the chroma component of the block T will be referred to as a luma block and a chroma block, respectively.

In case of 4:2:0 color format, the chroma block TC may correspond to the luma block TY. The quantization parameter prediction value of the chroma block may be derived using the quantization parameter of the corresponding luma block.

However, as illustrated in FIG. 7, the division structure between the luma block and the chroma block may be different. In this case, a chroma block may correspond to a plurality of luma blocks. The quantization parameter prediction value of the chroma block may be derived using a quantization parameter of one of the plurality of luma blocks. In this case, a luma block corresponding to the position of the center sample or the position of the top-left sample of the chroma block may be used. A luma block having the largest area overlapping the chroma block may be used. Alternatively, the quantization parameter prediction value of the chroma block may be derived through calculation of an average value, a median value, a minimum value, a maximum value, a mode value, and the like of quantization parameters of a plurality of luma blocks.

The quantization parameter prediction value of the chroma block may be derived using the quantization parameter of the neighboring block, which has been described in detail with reference to FIG. 6, and a detailed description thereof will be omitted here.

As described above, the quantization parameter prediction value of the chroma block may be derived by using both the method using the quantization parameter of the corresponding luma block (first method) and the method using the quantization parameter of the neighboring block of the chroma block (second method). Alternatively, the quantization parameter prediction value of the chroma block may be derived by selecting either the first method or the second method.

The selection may be performed in consideration of whether or not the luma block and the chroma block have the same division structure, the prediction mode, the intra prediction mode, the color format, or the size/shape relating to the block T. For example, if the block T is encoded in the inter mode and the division structure of the chroma block is the same as the division structure of the luma block, the quantization parameter of the chroma block may be predicted using the first method. Alternatively, if the division structure of the chroma block is the same as the division structure of the luma block, the first method is used; otherwise, the second method may be used. Alternatively, if the intra prediction mode of the block T is the LM mode, the quantization parameter of the chroma block may be predicted using the first method.

Alternatively, the selection may be performed based on information specifying either the first method or the second method. The information may be encoded and signaled by an encoding apparatus. The information may be signaled in at least one level of a video sequence, picture, or other fragment area (e.g., slice, tile, Coding Tree Block row, and block).

The quantization parameter of the chroma block may be derived to be the same as the derived quantization parameter prediction value of the chroma block, or may be derived by adding a quantization parameter difference value to the quantization parameter prediction value. In addition, the derived quantization parameter may be modified using a predetermined quantization parameter offset, as illustrated in FIG. 5.

For example, in the case of a chroma block encoded in the LM mode, the quantization parameter prediction value may be set equal to a quantization parameter. In this case, the quantization parameter difference value may not be signaled, or the process of adding the signaled quantization parameter difference value may be omitted. Alternatively, in the case of a chroma block encoded in the LM mode, the quantization parameter may be modified using one, two or more quantization parameter offsets.

FIG. 8 illustrates a quantization parameter derivation method based on a signaling unit of a quantization parameter difference value (deltaQP) according to an embodiment of the present invention.

The encoding apparatus may determine a unit of a block for encoding deltaQP and encode information indicating the size of the block. Here, the size may be represented by at least one of a width or a height of a block, a product of a width and a height, a sum of a width and a height, and a minimum value/a maximum value of a width and a height. The decoding apparatus decodes the signaling information to obtain the minimum size of a block in which signaling of deltaQP is allowed. The information may be signaled at a level of at least one of a video sequence, a picture, a slice, or a tile. Alternatively, the minimum size may be derived as a minimum size of the transform block, or may be defined as a fixed size pre-defined in the encoding/decoding apparatus. For example, the minimum size may be defined as 4×4, 8×4, 4×8, 8×8, and the like. The information indicating the size of the block may be signaled for the luma component and the chroma component, respectively. Alternatively, the minimum size for the chroma block may be derived based on the minimum size for the luma block. For example, in 4:2:0 color format, the minimum size of the chroma block may be determined to be half of the minimum size of the luma block. In the inter mode, the division structure of the chroma block may be different from that of the luma block, and the minimum size of the chroma block may be determined to be half of the luma block.

Referring to FIG. 8, the quantization parameter of the current block may be derived based on the comparison result between the size of the current block and the minimum size. Here, the current block may be a block that is not further divided by the block division type such as QT, BT, TT, or etc.

FIG. 8(a) illustrates a case where the size of the current block is 2M×2N and the minimum size is M×N. As illustrated in FIG. 8(a), when the size of the current block is larger than the minimum size, the quantization parameter of the current block may be derived using QPpred and signaled deltaQP.

The QPpred may be derived based on at least one of the first method or the second method described above. The deltaQP may be signaled at block a and the remaining blocks b, c, d may share the deltaQP signaled from block a. In this case, the current block has one quantization parameter. Alternatively, the deltaQP may be signaled for each of blocks a-d with the minimum size. In this case, a quantization parameter may be derived for each of the blocks a-d belonging to the current block, and blocks a-d may have different quantization parameters.

Meanwhile, if the size of a current block is equal to the minimum size, it may be derived using the QPpred and the signaled deltaQP.

FIG. 8(b) illustrates a case where the minimum size is M×N and the current block (a-d) is smaller than the minimum size. As illustrated in FIG. 8(b), if the size of the current block is smaller than the minimum size, the quantization parameter of the current block may be derived using QPpred and signaled deltaQP.

The QPpred may be derived, based on the current block, using at least one of the first method or the second method described above. For example, QPpred may be derived for each of blocks a-d. Alternatively, QPpred may be derived for block a, and the remaining blocks b-d may share QPpred derived from block a. Alternatively, the QPpred may be derived, based on the upper block of the current block, using at least one of the first method or the second method described above. Here, the upper block may be a block including the current block and a block having a smaller depth than the current block. For example, when the division depth of the current block is k, the division depth of the upper block may be (k−1), (k−2), and so on. The upper block may be defined as a unit of a block sharing the QPpred. The upper block may be set to a size (M×N) equal to the minimum size. Alternatively, the encoding apparatus may determine a unit of a block sharing the QPpred, and may encode information specifying a unit of the block. The decoding apparatus may specify the position, size, shape and the like of the upper block based on the encoded information.

The deltaQP may be signaled in the upper block of the current block. Here, the upper block may be a block including a current block, and a block having a smaller depth than the current block. That is, when the division depth of the current block is k, the division depth of the upper block may be (k−1), (k−2), and so on. Here, it is assumed that the upper block is M×N illustrated in FIG. 8(b). Thus, a single and same quantization parameter may be derived for blocks a-d, and a different quantization parameter may be derived for each of blocks a-d. Alternatively, if the size of the current block is smaller than the minimum size as illustrated in FIG. 8(b), the quantization parameter of the current block may be derived using QPpred. In this case, decoding for deltaQP may be omitted. As described above, the QPpred may be derived, based on the current block or the upper block, using at least one of the first method and the second method, and a detailed description thereof will be omitted. Similarly, a single and same quantization parameter may be derived for the blocks a-d belonging to the M×N block, and a different quantization parameter may be derived for each of blocks a-d.

On the other hand, in the case of a block adjacent to the boundary of a picture, a slice, or a tile, the block may not satisfy the minimum size. In this case, the quantization parameter of the block may be derived using only QPpred, and decoding for deltaQP may be omitted.

FIG. 9 illustrates an inverse transform process of a residual coefficient according to an embodiment of the present invention.

Referring to FIG. 9, a residual sample of a residual block may be reconstructed by performing at least one of a first inverse transform or a second inverse transform on the residual coefficient.

The second inverse transform may be applied to the entire area of the residual block or a partial area within the residual block. The partial area may mean a low frequency area in the residual block. The area to which the second inverse transform is applied may be variably determined in consideration of at least one of the size/shape of the residual block or the size/shape of the transform matrix of the second inverse transform.

For example, if either the width or the height of the residual block is equal to or greater than 8, a second inverse transform with an 8×8 transform matrix may be applied. When the size of the residual block is 8×8, the second inverse transform is applied to the entire area of the residual block, and when the size of the residual block is 16×16, the second inverse transform may be applied to only a partial area of the residual block. The partial area may be an 8×8 area located at the top-left of the residual block, a 16×8 area located at the top end of the residual block, an 8×16 area located at the left of the residual block, or the area excluding the 8×8 area located at the bottom-right of the residual block.

Alternatively, if either the width or height of the residual block is 4, a second inverse transform with a 4×4 transform matrix may be applied. When the size of the residual block is 4×8 or 8×4, the second inverse transform may be applied only to a partial area of the residual block (e.g., a 4×4 area located at the top-left of the residual block), and the second inverse transform may be applied to each of two 4×4 areas belonging to the residual block.

The size of the transform matrix of the second inverse transform may be 4×4, 8×8, 16×16, 32×32 or more. The shape of the transform matrix is not limited to a square, but may be implemented as a non-square. However, in order to reduce the complexity of the transform, the size of the transform matrix allowed for the second inverse transform may be limited to N×M or less. N and M may be 4, 8, or 16, respectively, and N and M may be the same or different from each other.

In the second inverse transform process, the transform type of the residual block may be determined through the transform type derivation method described in FIG. 5. Alternatively, the transform type in the second inverse transform may be pre-defined in the encoding/decoding apparatus. For example, as the transform type in the second inverse transform, one of the above-mentioned five transform types may be fixedly used.

The second inverse transform may be selectively performed based on a flag indicating whether the first inverse transform is skipped (hereinafter referred to as a first flag) in the residual block. That is, when the first inverse transform is skipped in the residual block according to the first flag, the performance of the second inverse transform may be skipped.

Alternatively, a flag indicating whether the second inverse transform is skipped (hereinafter referred to as a second flag) may be signaled separately. If the second flag is 1, a second inverse transform is not performed, and if the flag is 0, a second inverse transform may be performed. The first flag and the second flag may be independently encoded and signaled. Alternatively, either one of the first flag and the second flag may be signaled depending on the other. For example, only when either one of the first flag and the second flag is 1, the other may be signaled. Conversely, only when either one of the first flag and the second flag is 0, the other may be signaled.

The second inverse transform may not be applied when the number of non-zero residual coefficients belonging to the residual block is smaller than n. Where n may be a value pre-defined to the encoding/decoding apparatus. For example, n may be a natural number of 1, 2, 3 or 8 or less. Alternatively, n may be variably determined based on the size of the residual block.

Meanwhile, FIG. 9 illustrates performing the second inverse transform before the first inverse transform, but it does not limit the order of performing the inverse transform. That is, the second inverse transform may be performed before the first inverse transform, or may be performed after the first inverse transform. When the second inverse transform is performed before the first inverse transform, the scaling described in FIG. 5 may be performed between the dequantization and the second inverse transform, or may be performed between the first inverse transform and the second inverse transform. Conversely, when the second inverse transform is performed after the first inverse transform, the scaling described in FIG. 5 may be performed between the dequantization and the first inverse transform, or may be performed between the first inverse transform and the second inverse transform.

Although the exemplary methods of this disclosure are represented by a series of acts for clarity of explanation, they are not intended to limit the order in which the steps are performed, and if necessary, each step may be performed simultaneously or in a different order. In order to implement the method according to the present disclosure, the illustrative steps may additionally include other steps, include the remaining steps except for some steps, or may include additional steps other than some steps.

The various embodiments of the disclosure are not intended to be all-inclusive and are intended to illustrate representative aspects of the disclosure, and the features described in the various embodiments may be applied independently or in a combination of two or more.

In addition, various embodiments of the present disclosure may be implemented by hardware, firmware, software, or a combination thereof. In the case of hardware implementation, the hardware may be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), general processor, a controller, a micro-controller, a micro-processor, and the like.

The scope of the present disclosure includes a software or machine-executable instructions (e.g., operating system, applications, firmware, program, etc.) which makes operations according to the methods of the various embodiments be performed on the apparatus or computer and a non-transitory computer-readable medium, in which such software or instructions are stored, executable on the apparatus or computer.

INDUSTRIAL APPLICABILITY

The present disclosure may be used to encode/decode video signal. 

1. A method of decoding a video, comprising: deriving a residual coefficient of a residual block from a bitstream; calculating a quantization parameter for the residual block; performing inverse quantization on the residual coefficient using the calculated quantization parameter; and reconstructing a residual sample of the residual block by performing an inverse transform on the inverse quantized residual coefficient.
 2. The method of claim 1, wherein the quantization parameter is derived based on at least one of a quantization parameter prediction value or a quantization parameter difference value.
 3. The method of claim 2, wherein the quantization parameter prediction value is derived based on quantization parameters of one or more neighboring blocks, and the neighboring block is a block spatially or temporally adjacent to the residual block.
 4. The method of claim 2, wherein the quantization parameter difference value is determined based on a size of a block in which signaling of the quantization parameter difference value is allowed.
 5. The method of claim 2, wherein calculating comprises modifying the calculated quantization parameter based on a predetermined quantization parameter offset.
 6. The method of claim 1, wherein the residual block is divided into a variable size/shape based on at least one of a quad tree, a binary tree, or a triple tree.
 7. An apparatus for decoding a video, comprising: entropy decoding unit deriving a residual coefficient of a residual block from a bitstream; inverse quantization unit calculating a quantization parameter for the residual block, and performing inverse quantization on the residual coefficient using the calculated quantization parameter; and inverse transform unit reconstructing a residual sample of the residual block by performing an inverse transform on the inverse quantized residual coefficient.
 8. The apparatus of claim 7, wherein the inverse quantization unit derives the quantization parameter based on at least one of a quantization parameter prediction value or a quantization parameter difference value.
 9. The apparatus of claim 8, wherein the inverse quantization unit derives the quantization parameter prediction value based on quantization parameters of one or more neighboring blocks, wherein the neighboring block is a block spatially or temporally adjacent to the residual block.
 10. The apparatus of claim 8, wherein the inverse quantization unit determines the quantization parameter difference value based on a size of a block in which signaling of the quantization parameter difference value is allowed.
 11. The apparatus of claim 8, wherein the inverse quantization unit modifies the calculated quantization parameter based on a predetermined quantization parameter offset.
 12. The apparatus of claim 7, wherein the residual block is divided into a variable size/shape based on at least one of a quad tree, a binary tree, or a triple tree. 